package ru.ifmo.thesis.suite;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import ru.ifmo.thesis.task.Task;
import ru.ifmo.thesis.task.TaskGenerationOptions;
import ru.ifmo.thesis.task.TaskGenerator;
import ru.ifmo.thesis.util.Loggers;

public class TaskSuiteGenerator {

	public static void main(String[] args) throws IOException {
		Loggers.initLoggerFromConfig();
		
		String outputFileName = args[0];
		int taskCount = Integer.valueOf(args[1]);
		
		TaskGenerationOptions options = new TaskGenerationOptions();
		options.setGenerateContractsCount(550);
		options.setTaskGenerationCount(30);
		options.setWorkersCount(10);
		
		TaskGenerator generator = new TaskGenerator();
		
		List<Task> generatedTasks = new ArrayList<Task>();
		for (int i = 0; i < taskCount; i++) {
			generatedTasks.add(generator.generateTask(options));
		}

		SuiteSerializer.writeZippedSuite(
				new TaskSuite(options, generatedTasks), 
				new FileOutputStream(outputFileName));
	}
}
